<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Login</title>
  <link href="css/MyLogin.css" rel="stylesheet" type="text/css">
</head>
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
<script type="text/javascript">
  $(function (){
    $("#uname").blur(function (){
      var uname = $(this).val();
      $.ajax({
        url:"/testuname",
        data:"username="+uname,
        type:"post",
        dataType:"text",
        success:function(rs){
          console.log(rs);
          $("#rs").html(rs);
        }
      })
      $.post("/getuser","uname="+uname,function (rs){
        const rso = eval("("+rs+")");
        console.log(typeof rso);
        console.log(rso);
        $("#uname").val(rso.username)
        $("#password").val(rso.password)
      })
    })
  })
</script>
<body>

<section>
  <!-- 背景颜色 -->
  <div class="color"></div>
  <div class="color"></div>
  <div class="color"></div>
  <div class="box">
    <!-- 背景圆 -->
    <div class="circle" style="--x:0"></div>
    <div class="circle" style="--x:1"></div>
    <div class="circle" style="--x:2"></div>
    <div class="circle" style="--x:3"></div>
    <div class="circle" style="--x:4"></div>
    <!-- 登录框 -->
    <div class="container">
      <div class="form">
        <h2>登录</h2>
        <form action="login.jsp" method="post">
          <div class="inputBox">
            <input id="uname" name="name" type="text" placeholder="账户" required autofocus>
            <span id="rs"></span>
          </div>

          <div class="inputBox">
            <input id="password" name="password" type="password" placeholder="密码" required>
          </div>
          <div class="inputBox">
            <input type="submit" value="登录">
          </div>

          <p class="forget">忘记密码?<a href="#">点击这里</a></p>
          <p class="forget">没有账户?<a href="#">注册</a></p>
        </form>
        <form action="/upload" method="post" enctype="multipart/form-data">
          <div class="inputBox">
            图片：<input  name="image" type="file" placeholder="请上传图片" required><br>
            <input type="submit" value="上传图片"  required>
          </div>
        </form>
      </div>
    </div>
  </div>
</section>


</body>
</html>
